package com.ushine.web.component.task.handler;

import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @Author: yls
 * @Date: 2022/02/27 10:50
 * @Description: 队列满，线程被拒绝执行策略
 * @Version 1.0
 */
public class TemplateRejectedExecutionHandler implements RejectedExecutionHandler {
    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        throw new RejectedExecutionException("当前队列任务已满，请稍候再尝试提交！！！任务信息： " + r.toString() +
                "执行器信息：" +
                executor.toString());
    }
}
